package com.xiaochong.bitong.api.controller;

import com.xiaochong.bitong.api.service.MarketIndexService;
import com.xiaochong.bitong.api.utils.ApiVersion;
import com.xiaochong.tir.common.data.vo.*;
import com.xiaochong.tir.common.data.vo.app.MarketAnalysisVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Project : xc-tir
 * @Package Name : com.xiaochong.bitong.api.controller
 * @Description : TODO 大盘指数相关
 * @Author : daizhiqing@xiaochong.com
 * @Creation Date : 2018年08月14日下午5:27
 * @ModificationHistory Who When What
 */
@RestController
@Api(value = "币通大盘指数")
@RequestMapping(value = ApiVersion.API_V1_PREFIX+"/marketIndex")
public class MarketIndexController {

    @Autowired
    MarketIndexService marketIndexService;

    @ApiOperation(value = "TIR大盘指数趋势图", notes = "TIR大盘指数，x轴时间，y轴大盘指数")
    @ApiImplicitParams(@ApiImplicitParam(name = "type", value = "1:3小时 2:一天 3:7天 4:30天 5:全部", required = true, dataType = "int", paramType = "query"))
    @GetMapping("/marketIndexApp")
    public ApiResultVo<ApiMarketIndexVo> getGrailIndex(@RequestParam(value = "type") int type){
        return marketIndexService.getGrailIndex(type);
    }

    @ApiOperation(value = "TIR盘指数诊断分析", notes = "TIR大盘得分，走势")
    @GetMapping("/getMarketAnalysisTotalResult")
    public ApiResultVo<MarketAnalysisVo> getMarketAnalysisTotalResult(){
        return marketIndexService.getMarketAnalysisTotalResult();
    }

    @ApiOperation(value = "TIR大盘涨跌幅", notes = "TIR大盘涨跌幅数据图表")
    @GetMapping("/getRiseAndFall")
    public ApiResultVo<GraliIntensity> getRiseAndFall(){
        return marketIndexService.getRiseAndFall();
    }

    @ApiOperation(value = "TIR赚钱效应", notes = "TIR赚钱效应数据图表")
    @ApiImplicitParams(@ApiImplicitParam(name = "type", value = "1:3小时 2:一天 ", required = true, dataType = "int", paramType = "query"))
    @GetMapping("/getMarkMoneyEffect")
    public ApiResultVo<GraliIntensity> getMarkMoneyEffect(@RequestParam(value = "type") int type){
        return marketIndexService.getMarkMoneyEffect(type);
    }


    @ApiOperation(value = "TIR权重表现", notes = "TIR权重表现数据图表")
    @ApiImplicitParams(@ApiImplicitParam(name = "type", value = "1:3小时 2:一天 ", required = true, dataType = "int", paramType = "query"))
    @GetMapping("/getMarketWeightsPerformance")
    public ApiResultVo<ApiMarketWeightsPerformance> getMarketWeightsPerformance(@RequestParam(value = "type") int type){
        return marketIndexService.getMarketWeightsPerformance(type);
    }


    @ApiOperation(value = "TIR量能变化", notes = "TIR量能变化数据图表")
    @ApiImplicitParams(@ApiImplicitParam(name = "type", value = "1:3小时 2:一天 ", required = true, dataType = "int", paramType = "query"))
    @GetMapping("/getMarketInterpretationChange")
    public ApiResultVo<ApiMarketInterpretationChange> getMarketInterpretationChange(@RequestParam(value = "type") int type){
        return marketIndexService.getMarketInterpretationChange(type);
    }

}
